<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="${pageContext.request.contextPath }/css/editTablestyles.css">
<script type="text/javascript" src="${pageContext.request.contextPath }/webjars/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/listTable.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<form action="books.action?methodName=doAddBooks" method="post">
	<table class="querytable">
		<tr>
			<th class="textright">图书类型：</th>
			<td class="textleft">
				<select name="typeid" id="">
					<option value="0">--请选择--</option>
					<c:forEach items="${tlist }" var="type">
						<option value="${type.typeid }">${type.typename}</option>
					</c:forEach>
				</select>

			</td>
			<td id="resultTypeId"></td>
		</tr>
		<tr>
			<th class="textright">图书名称：</th>
			<td class="textleft">
				<input type="text" name="bookname" id="bookname">
			</td>
			<td id="resultBookname"></td>
		</tr>
		<tr>
			<th class="textright">作者：</th>
			<td class="textleft">
				<input type="text" name="author" id="author">
			</td>
			<td id="resultAuthor"></td>
		</tr>
		<tr>
			<th class="textright">出版社：</th>
			<td class="textleft">
				<input type="text" name="publish" id="publish">
			</td>
			<td id="resultPublish"></td>
		</tr>
		<tr>
			<th class="textright">图书简介：</th>
			<td class="textleft">
				<input type="text" name="lib">
			</td>
			<td></td>
		</tr>
		<tr>
			<td colspan="3" align="center">
				<input type="submit" value="保存图书信息">
			</td>
		</tr>
	</table>
</form>
</body>
<script type="text/javascript">
$(function() {
	$("input[type='submit']").click(function() {
		var gradename=$("#gradeid").val();
		var bookname=$("#bookname").val();
		var author=$("#author").val();
		var publish=$("#publish").val();
		if (gradename=="0") {
			$("#resultGradename").html("请选择图书种类");
			return false;
		}
		if (bookname=="") {
			$("#resultBookname").html("请输入图书名称");
			return false;
		}
		if (author=="") {
			$("#resultAuthor").html("请输入作者名称");
			return false;
		}
		if (publish=="") {
			$("#resultPublish").html("请输入出版社");
			return false;
		}
		
	});
});


</script>
</body>
</html>